const tips = "格式不正确, 请输入重新输入";
export const RULE = {
  NOT_NULL: { required: true, message: "必填项不能为空" },
};
export const validator = {
  mobile: (value, cb) => {
    return /^1[3456789]\d{9}$/.test(value) ? true : cb(tips);
  },
  email: (value, cb) => {
    return /^\w+@[0-9a-z]+\.[a-z]+$/.test(value) ? true : cb(tips);
  },
  release_version: (value, cb) => {
    return /^(\d+\.){2}[\w.]+$/.test(value) ? true : cb(tips);
  },
  ip: (value, cb) => {
    return /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/.test(
      value
    )
      ? true
      : cb(tips);
  },
};
